﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Rider : Ship
{
    public ParticleSystem m_AddtionalFireTell;
    bool m_IsOpen = false;

    float m_DurationTimeCount = 0;
    public float m_DurationTimeMax = 5;
    public float m_VelocityIncrement = 4.3f;
    float m_RotationIncrement = -0.6f;
    protected new void Update()
    {
        base.Update();
        if (!m_IsOpen)
            return;

        if (m_IsOpen)
        {
            moveForward();
            m_DurationTimeCount += Time.deltaTime;
            if (m_DurationTimeCount > m_DurationTimeMax)
            {
                m_DurationTimeCount = 0;
                m_IsOpen = false;
                VelocityMutiple -= m_VelocityIncrement;
                RotationMutiple -= m_RotationIncrement;
                m_AddtionalFireTell.Stop();
            }
        }
    }

    override public void moveBack()
    {
        if(!m_IsOpen)
            base.moveBack();
    }
    public override bool LaunchSkill()
    {
        if (!base.LaunchSkill())
            return false;

        m_IsOpen = true;
        VelocityMutiple += m_VelocityIncrement;
        RotationMutiple += m_RotationIncrement;
        m_AddtionalFireTell.Play();
        return true;
    }
}
